<?php

/**
 * AcctTpl form base class.
 *
 * @method AcctTpl getObject() Returns the current form's model object
 *
 * @package    tinystockmis
 * @subpackage form
 * @author     Linfeng Wu
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseAcctTplForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'acct_code'    => new sfWidgetFormInputText(),
      'acct_name'    => new sfWidgetFormInputText(),
      'acct_type_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AcctType'), 'add_empty' => false)),
      'category_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AcctCategory'), 'add_empty' => false)),
      'fdc'          => new sfWidgetFormChoice(array('choices' => array('d' => 'd', 'c' => 'c'))),
      'increase'     => new sfWidgetFormChoice(array('choices' => array('d' => 'd', 'c' => 'c'))),
      'memo'         => new sfWidgetFormInputText(),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'acct_code'    => new sfValidatorString(array('max_length' => 45)),
      'acct_name'    => new sfValidatorString(array('max_length' => 45)),
      'acct_type_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AcctType'))),
      'category_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AcctCategory'))),
      'fdc'          => new sfValidatorChoice(array('choices' => array(0 => 'd', 1 => 'c'), 'required' => false)),
      'increase'     => new sfValidatorChoice(array('choices' => array(0 => 'd', 1 => 'c'))),
      'memo'         => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('acct_tpl[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'AcctTpl';
  }

}
